import axios from '@/libs/api.request'

export const getProjectNames = () => {
  return axios.request({
    url: 'api/HttpAutoTestService/project/names/',
    method: 'get'
  })
};

export const getProjects = (val) => {
  return axios.request({
    url: 'api/HttpAutoTestService/projects/',
    params: val,
    method: 'get'
  })
};

export const getProjectById = (id) => {
  return axios.request({
    url: `api/HttpAutoTestService/projects/${id}/`,
    method: 'get'
  })
};

export const createProject = (project) => {
  return axios.request({
    url: 'api/HttpAutoTestService/project/',
    data: project,
    method: 'post'
  })
};

export const deleteProject = (id) => {
  return axios.request({
    url: `api/HttpAutoTestService/project/${id}/`,
    method: 'delete'
  })
};

export const updateProject = (project) => {
  return axios.request({
    url: `api/HttpAutoTestService/project/${project.id}/`,
    data: project,
    method: 'put'
  })
};
